<?php

session_start();
//if( isset($_SESSION['last_key']) ) header("Location: weibolist.php");
include_once( 'config.php' );
include_once( 'weibooauth.php' );



$o = new WeiboOAuth( WB_AKEY , WB_SKEY  );

$keys = $o->getRequestToken();
$aurl = $o->getAuthorizeURL( $keys['oauth_token'] ,false , 'http://127.0.0.1:8080/zendworkspace/abesaying/callback.php');

$_SESSION['keys'] = $keys;



?>
<html>
<head>
<script src="jquery.js" type="text/javascript" language="javascript"></script>
<script type="text/javascript" language="javascript">
	function login(){
		window.open("<?=$aurl;?>","newwindow");
		testLogin();
	}
	function testLogin(){
		$.post("test.php",null,function(data){
			if(data=='1'){
				alert("登陆成功");
			}else{
				setTimeout(testLogin,1000);
			}
	    });
	}
</script>
</head>

<body>
<input type="button" value="login" onclick="login();"/>
</body>
</html>
